// mircoApp/jianzhimao-withdraw/jianzhimaoAgentSign.js
const app = getApp();
Page({
  /**
   * 页面的初始数据
   */
  data: {
    mobile: '',
    idcard: '',
    name: ''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    this.getData();
  },
  getData() {
    let urlStr = app.getNetAddresss(
      "plugin.jianzhimao-withdraw.frontend.member-info.electronic-mobile"
    );
    app._getNetWork({
      url: urlStr,
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          this.setData({
            form: res.data
          })
        } else {
          app.tips(res.msg);
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },
  bind() {
    console.log(this.data.mobile)
    if (app._isTextEmpty(this.data.mobile)) {
      app.tips('请填写手机号码')
      return
    }
    if (app._isTextEmpty(this.data.idcard)) {
      app.tips('请填写身份证')
      return
    }
    if (app._isTextEmpty(this.data.name)) {
      app.tips('请填写姓名')
      return
    }
    let {mobile,idcard,name} = this.data;
    app._getNetWork({
      url: app.getNetAddresss(
        "plugin.jianzhimao-withdraw.frontend.member-info.electronic-user"
      ),
      data: {
        mobile,idcard,name
      },
      success: (resdata) => {
        var res = resdata.data;
        if (res.result == 1) {
          wx.navigateBack({
            delta: 1
          })
        } else {
          app.tips(res.msg);
        }
      },
      fail: function (res) {
        console.log(res);
      },
    });
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {},
});